#include "ScnsKeyboardGpio.c.h"

#if defined(SCNS_KEYBOARD_GPIO_ENABLE)&&SCNS_KEYBOARD_GPIO_ENABLE==1

#include "ScnsKey.h"

const ScnsKeyEnum scnsBspKeyboardGpioKeyEnum[SCNS_BSP_KEYBOARD_GPIO_KEY_MAX]={
    SCNS_KEY_SELECT,
    SCNS_KEY_UP,
    SCNS_KEY_DOWN,
    SCNS_KEY_START,

};

static const PIN_enum ptx[SCNS_BSP_KEYBOARD_GPIO_KEY_MAX]={
    P22_0,P22_1,P22_2,P22_3,
};




ScnsKeyPress scnsBspKeyboardGpioGet(uint8 keyN)
{
    return ((gpio_get(ptx[keyN])==0)?SCNS_KEY_PRESS_DOWN:SCNS_KEY_PRESS_UP);
}

ScnsKeyboardStatus scnsBspKeyboardGpioInit(void)
{
    for(uint8 keyN=0;keyN<SCNS_BSP_KEYBOARD_GPIO_KEY_MAX;++keyN)
        gpio_init(ptx[keyN],GPI,0,PULLUP);
    return SCNS_KEYBOARD_STATUS_OK;
}

ScnsKeyboardStatus scnsBspKeyboardGpioPostInit(void)
{
    return SCNS_KEYBOARD_STATUS_OK;
}

#endif
